The first thing two do is fire up Winamp3 and open the AVS editor. Create a new empty preset and add a Render/Superscope. Now you should have a spiral spinning around on the screen(make sure you turn on clear every frame in Main). Looking at the actual body of the Superscope may not mean anything at all to you. The first thing you need to know about it are the variables used in it. Hopefully after reading this you will be able to understand at least what the variables mean and do.
A superscope(SSC) plots points on the AVS screen. It will also draw lines if you select "Lines" in the lower right-hand corner, in which case it just connects the consecutive points. Normally these points are plotted based on math equations, but they can be plotted randomly, or at some fixed points. In order for AVS to know where to plot these points you have to specify using the different variables. There are several variables that come built-in to AVS, but you can also create your own user-defined variables. These variables are used in order for you to be able to do many things that you can't do without them, including keeping track of "time" and possibly speed of different points. The next sections will teach you what the built-in variables are, as well as some commonly used user-defined variables.
N is the variable used to define the number of points that you will be using in the SSC. For most smooth curves in an avs window this will range from 100 - 1000 depending on the length of the curve. For example, in the default spiral SSC, changing the value of n in the init box can make a big difference in what it looks like. For example, if you change it to 50, then there will be much fewer points displayed and it won't look like a solid curve anymore(at least not when music is actively playing). If you change it to 8000, however, you won't even be able to tell that they are dots anymore(unless you are running at a really high resolution). Notice, however, that it is now moving a lot slower which isn't good. Having an acceptable value for n can make a big difference in the speed of the preset, and you should always make sure that it isn't excessively high - framerate is very important in AVS.
In order for AVS to know where to plot the different points, it has to know the location that they are supposed to be placed at. It does this using the commonly used x and y coordinate system, although it is slightly different. The x and y axes both go from negative 1 to positive 1, but y=-1 is at the top of the screen, not at the bottom like it is in math. For now there isn't much you can do except just plot points, but you can go ahead and do that if you want. For example, clear out all of the text fields in a SSC and set n=1 in the init box. Then, in the Per Point box put:
x=-.75; y=.5;
This should place a point on your screen near the bottom left=hand corner of the AVS screen. You can go ahead and try using the different math functions and try to figure out how to do more complicated things, or just look at Lesson 02. There are still some important variables left, though, so if you do skip ahead make sure that you come back and check out the rest.
I is the current position that the superscope is at in relation to its entire length. It is kind of hard to explain, but I'll try here. What AVS does when plotting the different points is as follows:
It starts by setting a counter to 0 or 1(most likely 0). Then it plots the first point, increments the counter by one, plots the second point, increments the counter by one, etc. until it has plotted n number of points. I refers to the percent completion of plotting the superscope. I could be replaced by the following:
i=[counter variable] / n;
The first time through, the counter variable would be equal to 0, and i would be 0/n, or 0. The fifth time
through, i would be 5/n, and the nth time through, i would be n/n, or 1.
One of the major uses of the variable i is to make lines. The following code should create a line that goes from the center of the screen to the right of the screen(make sure you set a reasonable value for n):
x=i; y=0;
This works because x will increase by small steps from 0 to 1 and plot each of the points. If you want to fill the entire row with a line then you have to multiply i by 2 because the screen goes from -1 to 1(a span of 2) and since i normally only goes from 0 to 1 this will change it so that it goes from 0 to 2. But since we want it to go from -1 to 1, you then subtract 1 from i, like below:
x=i*2-1; y=0;
If you want a vertical line instead, just switch the x and y expressions like this:
x=0; y=i*2-1;
You can also move these lines left and right or up and down by changing 0 to something else. For example:
x=.5; y=i*2-1;
And if you want to create a diagonal line, then all you need to do is make both x and y have i in them:
x=i*2-1; y=i*2-1;
If you want to try to make your own lines, go ahead. Try changing the numbers some to see what they do so that you make sure that you understand how it works.
V is a cool little variable that lets you add some music responsiveness to your SSC. It ranges from -1 to 1 and you can make some neato oscilloscope things with it. Since I'm not sure exactly how it works(it somehow uses the music's oscilloscope/spectroscope data and i to come up with a number), I will just tell you what can be done with it and show you some nice examples. One thing to be careful of when using v is that it has a huge range and will need to be smaller for most practical uses. This can be done by dividing my some number or by multiplying by a fraction(quicker). Here is one example of it(make sure you find a good value for n):
x=i*2-1; y=v*.3;
This creates a nice-looking oscilloscope-like curve. If you want this curve to be vertical, then just switch x and y:
x=v*.3; y=i*2-1;
And if you want it to be on a diagonal then just do it like this:
x=i*2-1+v*.3; y=i*2-1-v*.3;
Notice on the last one that in the y expression, v is subtracted. This is because in this diagonal line(without v) x is always equal to y, and if you add v to the x and y variables then the entire line will be on the diagonal. If you subtract v from either the x or the y variable, however, it will cause it to move off the diagonal, which is what makes it look like an oscilloscope. Go ahead and mess around with this new variable and see what you can create.
I'm just including this variable in here for completeness, although it is very rarely used since there is a Per Beat textbox that allows you to do a lot more. Most of the time b will be equal to 0, but if winamp detects a beat in the music then it will set b equal to 1 for that frame and that frame only. It has a couple of uses, but nothing major. The only thing I have ever used it for is to create a flash on the screen. For example:
x=v*b; y=(i*2-1)*b;
All I did in this was take something that we had already made and multiplied both x and y by b. Note that if you have it plotting points instead of lines you will get a point at (0,0) which can be removed, but I'm not going to go into how right here. This causes it to flash on beat and looks like a really bad lightning bolt. If you want to try it with anything else go ahead.
These variables are often overlooked by n00bs, but can really help add some nice touches to your SSC. Using the color cycler in the bottom right corner creates presets that are really boring, but once you get a hang of it you can make some really nice looking SSC's with these variables. Each of these variables has the range (0,1), where at 0 there is none of that color and at 1 there is a full amount of that color. You can create different colors by giving nonzero values to more than one of these variables. For example, red and blue make purple. All three colors together make white. For an example, I'm going to return to one of our previous SSC's and add a nice gradient to it.
x=i*2-1; y=v; red=y*3; blue=-y*3; green=0;
If you put this with a slow Trans/Fadeout (turn off clear every frame in main as well) you get a nice looking red and blue superscope, although it isn't great. The best stuff comes with custom variables, which we are almost up to.
H and w are used to figure out the height and width of the screen in pixels. You can't use them to change the actual height and width though - only to figure out what it is. Not used very often, but they have a couple uses, which I won't get to now, but I will return to them in later lessons.
This is where all the cool stuff comes into play. In addition to AVS's built in variables you can create many of your own variables. The actual number depends on your computer, but it reportedly ranges from 32-256(most systems will have a max of 32 or 64 variables). In the next few paragraphs and code examples I will discuss some of the more widely used variables and some of their applications. You do not have to use these variable names, but it is suggested that you do so your code can be understand more easily.
One of the most commonly used custom variables is t. T is used to represent time, sometimes in the form of a counter. It is normally just incremented by a small amount each frame, and then used in the expressions defining the other variables such as x and y. For example, in the frame edit box put:
t=t+.01;
And in the pixel edit box put:
x=sin(t); y=cos(t);
This will make a dot that moves around the screen in a circle(or oval since the screen is most likely a rectangle). Here's another example using the same code in the frame box, but in the pixel box put:
x=sin(t); y=i*2-1;
And now you have a moving line. You can also make it change color over time. For example, to pulse between black and white you can use:
red=sin(t); blue=sin(t); green=sin(t);
Well, that's all the examples I'm going to give right now for t. Just try and make your own stuff using it. You'll probably have to try to figure out how to use some of the functions to make use of t, or you can wait until my next tutorial when I discuss all of the different functions.
Other common user variables are d and r. They are based on the polar coordinate system, which is an alternative to the Cartesian coordinate system(x and y). D is the distance between the point and the origin(the center of the screen). R is the measure of the angle counter-clockwise from the positive x axis to an imaginary ray that starts at the origin and intersects the point(thanks goes to 13373571 for helping me with the wording).